﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Abs.Core.Models.Blog
{
    public class Post
    {
        //
        //Private fields
        //

        private int status = (int) StatusEnum.Pending;

        //
        //Properties
        //

        public virtual int PostId { get; set; }

        [ForeignKey("User")]
        public virtual string UserEmail { get; set; }
        public virtual User.User User { get; set; }

        [ForeignKey("Category")]
        public virtual int CategoryId { get; set; }
        public virtual Category Category { get; set; }

        [Required]
        public virtual string Title { get; set; }

        [Required, DataType(DataType.MultilineText)]
        public virtual string ContentMessage { get; set; }

        //[DataType(DataType.Date)]
        public virtual DateTime Date { get; set; }

        [ForeignKey("Status")]
        public virtual int StatusId
        {
            get
            {
                return this.status;
            } 
            set
            {
                this.status = value;
            }
        }//end of public virtual int StatusId
        public virtual Status Status { get; set; }

        public virtual ICollection<Comment> Comments { get; set; }
    }//end of public class Post
}